Memory optimization

General notes

Turnkey memory optimization that is built-in and does not need any configuration:

  • Large blobs in a model are held in a shared location for all clients.
  • Pruning (deallocation) of unused data structures periodically, usually every few minutes, even in views and in the EcoSpaces of active users.
  • Removing ViewModels that have not been used for a few minutes.
  • Removal of subscriptions and change publishers within EcoSpaces every few minutes.

Using the ServerInfo page, you can temporarily tweak times for pruning stale apps and the intervals when the server does pruning. These settings are available to make it easier for you to tweak other settings without having to wait very long periods to see the effect.

.Net optimization settings for .Net Framework <4.8.1, not .Net core on IIS

When a .net application doesn't use objects anymore, they are garbage collected. The Garbage Collector (GC) can do its job in many ways.

By default, an MDriven Server uses the "Server" GC mode with the "Interactive" setting. This is to make the Garbage Collector run in the background and in a way that should minimize user "hick-ups", i.e. short delays for the user.

There's always a balance between user experience, memory use, and CPU use to consider.

  • Tuning GC for high-density Web hosting: GC can impact a site’s memory consumption, but it can be tuned to enable better performance. You can tune or configure GC for better CPU performance (slow down the frequency of collections) or lower memory consumption (that is, more frequent collections to free up memory sooner).
<performanceScenario value="HighDensityWebHosting"/>
  • Tuning only when memory usage on server low memory conditions, use gcTrimCommitOnLowMemory like this:
<gcTrimCommitOnLowMemory enabled="true"/>

In both these settings, you add the settings to the runtime section of the aspnet.config file in the C:\Windows\Microsoft.NET\Framework64\v4.0.30319 folder to achieve smaller memory consumption (working set) per site.

Aspnet.config file example.png
In an installation with more than one TK or MDS instance running on a Windows machine, we recommend both settings to make them run much better together, like this
See also: Turnkey Client Timeout
More reading:
This page was edited 20 days ago on 12/02/2024. What links here